import axios from "axios";
import uniAdapter from "./adapters/uni.js"

if (uni) {
    axios.defaults.adapter = uniAdapter
}

export default class VueAxiosHTTP {
    static install(app, options) {
        const pluginName = options?.pluginName ?? 'axios';
        const http = axios.create(options);
        if (app.prototype) app.prototype["$" + pluginName] = http;
        if (app.config && app.config.globalProperties) app.config.globalProperties["$" + pluginName] = http;
    }
}